//package com.vast.admin.service.impl;
//
//import cn.hutool.core.date.DateTime;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.vast.system.shiro.ShiroUtils;
//import org.springframework.stereotype.Service;
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.vast.admin.entity.RoleMenu;
//import com.vast.admin.mapper.RoleMenuMapper;
//import com.vast.admin.service.RoleMenuService;
//@Service
//public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService{
//
//
//    @Override
//    public void addOrUpdate(Long roleId, Long[] menuIds) {
//
//        //删除角色和菜单关系
//        baseMapper.delete(new QueryWrapper<RoleMenu>().eq(RoleMenu.COL_ROLE_ID, roleId));
//
//        //添加角色和菜单关系
//        if (menuIds != null && menuIds.length > 0) {
//            for (Long mId : menuIds) {
//                RoleMenu roleMenu = new RoleMenu();
//                roleMenu.setCreateBy(ShiroUtils.getUserId());
//                roleMenu.setUpdateBy(ShiroUtils.getUserId());
//                roleMenu.setCreateTime(DateTime.now());
//                roleMenu.setUpdateTime(DateTime.now());
//                roleMenu.setRoleId(roleId);
//                roleMenu.setMenuId(mId);
//                baseMapper.insert(roleMenu);
//            }
//        }
//    }
//}
